var app = getApp()
Page({
  data: {
    page: -1,
    url: {
      getMyYIndent: app.url.baseUrl + "/my/yIndent"
    },
    indentList: [],
    isNextPageData: true
  },
  onLoad: function (options) {
    
  },
  onShow:function(){
    this.setData({ page: -1, isNextPageData: true, indentList:[]})
    this.getNextIndent()
  },
  //得到下一页数据
  getNextIndent: function () {
    if (!this.data.isNextPageData){
      //提示
      return
    }
    var that = this
    var data = { pageNumber: this.data.page + 1 }
    app.ajax(this.data.url.getMyYIndent, data, function (res) {
      var data = that.data.indentList
        var tempd = res.data.data
        for(var i =0;i<tempd.length;i++)
          data.push(tempd[i])
        that.setData({ indentList: data, page: that.data.page += 1 })
        if (tempd.length <= 20) {
          that.setData({ isNextPageData : false})
        }
    })
  },
  onReachBottom:function(){
    this.getNextIndent()
  },
  //店铺信息跳转
  shopInfo: function (e) {
    var indentNo = e.currentTarget.dataset.indentno;
    wx.navigateTo({
      url: '../orderinfo/orderinfo?indentNo=' + indentNo
    })
  },
  //回复跳转
  comment: function (e){
    var indentNo = e.currentTarget.dataset.indentno;
    wx.navigateTo({
      url: "comment/comment?indentNo="+indentNo
    })
  }
})

